<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>基础表单</title>
    <link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/static/assets/module/admin.css?v=318"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        #formBasForm {
            margin: 30px auto;
        }
        #formBasForm .layui-form-item {
            margin-bottom: 25px;
        }
    </style>
</head>
<body>
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!-- 表单开始 -->
            <div>认证：http://im.eskj.lingtingkj.com:7080//task/triggerAuth?mobile=</div>
            <div>烟草证接口：http://im.eskj.lingtingkj.com:7080/task/queryTobaccoLicense?mobile=17130017779&licenseNum=422801119593</div>
            <div class="layui-form-item">
                <label class="layui-form-label ">认证手机号码:</label>
                <div class="layui-input-block">
                    <input  id="user_id" placeholder="" class="layui-input"
                           lay-verType="tips"  />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">烟草证编号:</label>
                <div class="layui-input-block">
                    <input placeholder=""  id="stringno" class="layui-input"
                           lay-verType="tips"   />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">认证结果:</label>
                <textarea rows="10" cols="100" id="res" data-clipboard-text=""></textarea>
                <br>
                <span style="color:red">tip:返回跟证件信息一致的时候，代表证件认证成功</span>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" id="formStepSubmit2">&emsp;生成&emsp;
                    </button>
                </div>
               

            </div>
            <!-- //表单结束 -->
        </div>
    </div>
</div>

<!-- js部分 -->
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/static/assets/js/common.js?v=318"></script>
<script type="text/javascript" src="/static/clipboard.min.js"></script>
<script>
    layui.use(['layer', 'form', 'laydate','jquery','flow'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;

        var apikey;
        /* 渲染laydate */
        laydate.render({
            elem: '#formBasDateSel',
            trigger: 'click',
            range: true
        });

        /* 监听表单提交 */
        form.on('submit(formBasSubmit)', function (data) {
            layer.msg(JSON.stringify(data.field));
            return false;
        });
        $("#copy").click(function(){
            
            var clipboard = new ClipboardJS('res');
                  clipboard.on('success', function(e) {
                      alert('复制成功');
                      clipboard.destroy();  //解决多次弹窗
                      e.clearSelection();
                  });
        })
        $("#formStepSubmit2").click(function(){
            
            var userid = $("#user_id").val();
            var stringno = $("#stringno").val();
            var url = "http://im.eskj.lingtingkj.com:7080/task/queryTobaccoLicense?mobile="+userid+"&licenseNum="+stringno;
            $("#res").text(url);
            
            return;
            if(userid == ''){
                layer.msg("用户id不能为空", {icon: 2, anim: 6});return;
            }
            if(stringno == ''){
                layer.msg("烟草编号不能为空", {icon: 2, anim: 6});return;
            }
            if(stringno.length != 12){
                layer.msg("烟草编号不正确", {icon: 2, anim: 6});return;
            }
            var loadIndex = layer.load(2);
            $.post('/index/Auth/authYancao', {
                userid: userid,
                stringno:stringno
            }, function (res) {
                layer.close(loadIndex);
                if(res.data){
                    console.log(res.data);
                    $("#res").text(res.data);
                }else{
                    layer.msg("认证失败", {icon: 2, anim: 6});
                }
            }, 'json');


        })

    });
</script>
</body>
</html>